@echo off
:: =================================
::	RunSetup.bat	2024-11-03
::
::	SetupEndCmd
:: =================================

if "%~1"=="" (
	set "SetupEndCmd=k"
) else (
	set "SetupEndCmd=%~1"
)

if "%~2"=="" (
	set "SetupAuto="
) else (
	set "SetupAuto=%~2"
)

set "SetupDriver=%~d0"
set "Setuppath=%~p0"

rem ====	基本系統設定 set 一定要加""避免空白
set "Driver=%~d0"
set "FilePath=%~p0"
set "ConfFile=%~n0"
set "FullPath=%~dp0"
set "FullPathFile=%~f0"

title %~nx0

rem ====----	IsAdmin
call :IsAdmin

cd /D "%Driver%%FilePath%"
rem ==--

rem call %HOMEDRIVE%\PortableApps\DownloadOffice365\SetupOffice365.cmd c auto
call %HOMEDRIVE%\PortableApps\DownloadOffice365\SetupOffice365.cmd %SetupEndCmd% %SetupAuto%

goto End

:IsAdmin
	reg.exe query "HKU\S-1-5-19\Environment" >nul
	if not %ERRORLEVEL% EQU 0 (
		echo 必須「以系統管理員身分執行」
		echo You must have administrator rights to continue ...
		pause & exit
	)
	exit /b

:End
	cd "%SetupDriver%%Setuppath%"
	%SetupDriver%
	%ComSpec% /%SetupEndCmd%
